﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文本框的自动全选</title>

    <script type="text/javascript" language="JavaScript">
        function selectAll(){
            mytxt.select();
        }

    </script>
</head>
<body>

<textarea id="mytxt" cols=30 rows=6 >
</textarea>
<input id="mybtn" value="全选" type="button" onclick="selectAll()" />

</body>
</html>